#pragma once
#include "RemoteThreadHelper.h"
#include "ATASHD3D.h"

#include <list>
using namespace std;

CONST LPCTSTR HD3D_LIBRARY = TEXT("ATASHD3D.dll");

class CD3DCaptor;

class CRemoteFunctionCreateCaptor : public CRemoteFunction
{
public:
	CRemoteFunctionCreateCaptor(CRemoteModuleBase* prm) : CRemoteFunction(prm)
	{
	}

	BOOL Create(LPCSTR pszName){return CRemoteFunction::Create(m_prm, pszName);}
	BOOL Execute(RPB_CreateCaptor& remoteCaptorParam);
};

class CD3DRemoteProcessCaptor
{
	CRemoteProcessIE m_rp;
	CRemoteModule m_rm;
	CRemoteFunction m_rfInit;
	CRemoteFunction m_rfFin;
	CRemoteFunctionCreateCaptor m_rfCreate;
	CRemoteFunction m_rfDestroy;
	list<CD3DCaptor*> m_lstCaptors;

public:
	CD3DRemoteProcessCaptor() : m_rm(&m_rp), m_rfInit(&m_rm), m_rfFin(&m_rm), m_rfCreate(&m_rm), m_rfDestroy(&m_rm)
	{
	}

	~CD3DRemoteProcessCaptor()
	{
		Destroy();
	}

	BOOL Create();
	void Destroy();

	BOOL CreateRemoteCaptor(RPB_CreateCaptor& remoteCaptorParam);
	BOOL DestroyRemoteCaptor(HCAPTOR hCaptor);

	CD3DCaptor* CreateCaptor(LPCSTR szDeviceName);
	BOOL DestroyCaptor(CD3DCaptor* pCaptor);

	HANDLE GetRemoteProcess(){return m_rp;}
	
};